class Calculate():
    
    def __init__(self):
        self.data=[]
        self.phones=[] #telefonu indikatoriai - stringai
        self.telInd=[] #irasu kiekis kiekvieno telefono. TIK skaitymui!
        self.curSpeed=[] # current speed
        
    def addData(self, raw_data):
        tempNr=-1
        temp=[raw_data[1],raw_data[2],raw_data[3],raw_data[4]]
        for i in range(len(self.phones)):
            if self.phones[i] == raw_data[0]:
                print "found existing phone"
                tempNr=i
                break
        if tempNr==-1 :
            tempNr=len(self.phones)
            self.phones.append(raw_data[0])
            self.data.append([])        #iskiriama vieta naujam phone ID
            self.telInd.append(0)
            #print "creating new ID " + self.phones[tempNr]
        #print self.data
        #print tempNr
        self.data[tempNr].append(temp)
        self.telInd[tempNr]+=1
    def dump(self):                                         #duom skaitymas pvz
        print "we have phones " +str(len(self.phones))
        print self.data
        for i in range(len(self.phones)):
            print "i " + str(i)
            print "phone name"
            print self.phones[i]                #phone name text
            print "telInd"
            print self.telInd[i]
            for b in range(self.telInd[i]):
                print "phone record"
                print b
                print i
                #print self.telInd[b]
                print self.data[i][b] #prints timestamp x y z 
                
"""       
#DEBUGING        
test=Calculate()     
sm=["phone", 100, 1 , 2 ,3 ]       
test.addData(sm)
test.addData(["phone", 110, 2 , 3 ,4])
test.addData(["phone2", 111, 4 , 5, 5])
test.addData(["phone", 120, 4, 4,4])
test.addData(["phone2", 114, 5, 5, 5])
test.addData(["phone3",124,6,6,6])
test.addData(["phone", 20, 14, 2 ,2])
test.dump()
"""